<template>
	<view>
		<scroll-view style="height:100vh;"  :scroll-y="true" @scrolltolower="scrolltolowerfn">
			
			<view v-for="(item,index) in lists" :key="index" @click="selectRoute(item)">
				<route-list :item="item" @editroute="editroute" @delroute="delroute"></route-list>
			</view>
			
			<view class="affirm-content bg-white p-l-20 p-t-34 p-b-36 p-r-20">
				<navigator hover-class="none" url="/bundle/pages/add_route/add_route">
				<view class="affirm-btn  flex-content">
					添加常用路线
				</view>
				</navigator>
			</view>
			
			
			<view class="flex-content" style="padding-top:20rpx">
				没有更多路线咯
			</view>
			
			
			<view class=""style="height:200rpx">
				
			</view>
		</scroll-view >
	<u-modal :show-cancel-button="true" @confirm="delconfirm" v-model="showmodal " content="确定删除"></u-modal>
	</view>
	
</template>

<script>
	import {getRoute,delRouteInfo} from "@/api/car"
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins";
	export default {
			mixins: [MescrollMixin],
		data() {
			return {
			
				lists:[],
			
				scroll:{
					limit:10,
					page:1,
				},
                pagecount:""
			
			};
		},
		

		onLoad() {
			this.getdata()
		},
		methods:{
			async scrolltolowerfn(){
				
				this.scroll.page=this.scroll.page+1
				if(this.scroll.page<=this.pagecount){
					await this.getdata()
				}
				
			},
			async getdata(){
			let res=await getRoute(this.scroll)
			
				this.pagecount=Math.ceil(res.data.count/10)
			
				
				this.lists=[...this.lists,...res.data.lists]
				return res.data
					
			},
		
		
		
			
			
		}
	}
</script>

<style lang="scss" scoped>
	.btn-content{
	   width: 112rpx;
	   height: 48rpx;
	   border-radius: 10rpx;
	   border: 4rpx solid #BBBBBB;
	}
.affirm-content{
	height: 160rpx;
	position: fixed;
	bottom: 0px;
	width: 100%;
	background-color: #FFFFFF;
}
.affirm-btn{
	z-index: 999;
	background-color:#EE6841 ;
	width: 100%;
	height: 100%;
	height: 88rpx;
	color: #FFFFFF;
	border-radius: 12rpx;
}
.route-content{
	border-radius: 10rpx;
	overflow: hidden;
	background-color: #FFFFFF;
}

</style>
